package components

import (
	"eino-script/engine/entity"
	"eino-script/engine/types"
	"github.com/cloudwego/eino/compose"
)

type LoopNode struct {
	types.Node
	sourceId   string
	conditions map[string]BranchCondition
}

func CreateLoop(cfg *entity.Node, g *compose.Graph[any, any]) (types.BranchInterface, error) {
	n, err := CreateGeneralNode(cfg)
	if err != nil {
		return nil, err
	}
	node := &BranchNode{
		Node:       *n,
		conditions: make(map[string]BranchCondition),
	}

	return node, nil
}
